<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="renderer" content="webkit" />
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<meta name="App-Config" content="fullscreen=yes,useHistoryState=yes,transition=yes" />
		<meta content="yes" name="apple-mobile-web-app-capable" />
		<meta content="yes" name="apple-touch-fullscreen" />
		<meta content="telephone=no,email=no" name=format-detection />
		<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>首页</title>
	</head>
	<link href="../c/new_my.css" rel="stylesheet" />
	<link href="../c/tc.css" rel="stylesheet" type="text/css" />

	<body>
		<div class="header">
			<img class="bg" src="../i/new/my_bg.png">
			<img class="avatar" src="../i/touxiang.png">
		</div>
		<div class="setting">
			<div class="setting_item" style="width: 45%" onclick="_url({url:'member_sz',title:'编辑资料'})">编辑资料</div>
			<div class="setting_item" style="width: 30px" onclick="guanzhus()">
				<img src="../i/new/add.png">
			</div>
		</div>
		<div class="user_msg">
			<div class="user_name" onclick="_url({url:'member_sz',title:'编辑资料'})">
				<p></p>
			</div>
			<p class="user_id">愉直播号：</p>
		</div>
		<div class="ad_box" onclick="_url({url:'new_renwu',title:'任务系统'})">
			<img src="../i/new/ad.jpeg">
		</div>
		<p class="ad_text"></p>
		<div class="tag_box">
			<span></span>
			<span></span>
			<span></span>
		</div>
		<div id="menu">
			<div class="menu_item" style="background-image:url(../i/new/my_item1.png)" onclick="_url({url:'member_yaoqing',title:'邀请好友'})">
				<!-- {{= it[i].name}} -->
				我的邀请码
			</div>
			<div class="menu_item" style="background-image:url(../i/new/my_item2.png)" onclick="_url({url:'allpeople',title:'网红达人培训'})">
				<!-- {{= it[i].name}} -->
				网红达人培训
			</div>
			<div class="menu_item" style="background-image:url(../i/new/my_item3.png)" onclick="_url({url:'new_renwu',title:'任务系统'})">
				<!-- {{= it[i].name}} -->
				任务中心
			</div>
			<div class="menu_item" style="background-image:url(../i/new/my_item4.png)" onclick="_url({url:'member_sz',title:'编辑资料'})">
				设置
			</div>
		</div>
		<p style="height: 5rem;"></p>

		<div class="tabbar">
			<div class="tabbar_item" id="ind">
				<div class="item_icon icon1"></div>
				<p style="color: #585858">首页</p>
			</div>
			<!-- <div class="tabbar_item" id="btn" >
				onclick="_url({url:'zhibo_add',title:'开始直播'})"
				<div class=""><img src="../i/vip/zhibo.png"style="width: 1.8rem;opacity: 0.5;"></div>
				<p style="color: #585858">直播</p>
			</div> -->
			<div class="tabbar_item" id="btn">
				<div class="item_icon icon3" style="background-position-y: -36px;"></div>
				<p style="color: #F00056">我的</p>
			</div>
		</div>
		<div class="tca" style="position:absolute;left:0;right:0;top:0;bottom:0;z-index:999;display:none">
			<div class="tcmian">
				<div class="tcdiv">
					<div class="tis">
						<p>恭喜!</p>
						<p>您的好友 @
							<!-- 梧的小姐姐 -->
						</p>
					</div>
					<p class="user_imga" style="overflow: hidden;"><img src="" style="width:100%;"></p>
					<p class="text_p">在愉直播创建了工会/机构<br>
						赠送给你一个价值680的达人名额<br>
						立即通过请求, 免费成为达人~<br>
						每天专属任务获得达人收益！</p>
					<button class="tcbtn tybtn">拒绝</button>
					<button class="tcbtn jjbtn">同意</button>
				</div>
			</div>
		</div>
	</body>

</html>
<script src="../j/api.js"></script>
<script src="../j/jquery-3.3.1.min.js"></script>
<script>
	apiready = function() {
		var id = _getPrefs('_user');
		if (id == "" || id == null) {
			window.location.href = "login.html"
		}
		var urla = id.id;
		_ajax("user/info?", function(ret, err) {
			if (ret) {
				$(".user_name p").text(ret.nickname);
				if (ret.img == "" || ret.img == null) {

				} else {
					$(".avatar").attr("src", "" + _img(ret.img) + "");
				}
				$(".user_id").text("愉直播号：" + ret.haoma);
				$(".tag_box span").eq(0).text("" + ret.age + "岁");
				$(".tag_box span").eq(1).text("" + ret.city + "");
				$(".tag_box span").eq(2).text("" + ret.area + "");
				$(".ad_text").text(ret.qianming);
			}
		}, {
			uid: urla
		})
		_ajax('member/info', function(ret, err) {
			// console.log(JSON.stringify(ret));
			if (ret) {
				if (ret.is_invite == 1 || ret.is_invite == "1") {
					$(".tis p").eq(1).text("您的好友 @" + ret.invite_name + "");
					$(".user_imga img").attr("src", _img(ret.invite_img));
					$(".text_p").html("在愉直播创建了工会/机构<br>赠送给你一个价值" + ret.invite_money +
						"的达人名额<br/>立即通过请求, 免费成为达人~<br>完成每天专属任务获得达人收益！");
					$(".tca").css("display", "block");
				}
			}
		})

		api.addEventListener({
			name: 'viewappear'
		}, function(ret, err) {


		})

		$(".tybtn").on("click", function() {
			_ajax('member/do_invite', function(ret, err) {
				// console.log(JSON.stringify(ret));
				if (ret) {
					_msg("已拒绝加入！");
					$(".tca").css("display", "none");

				} else {
					_msg("网络错误")
					$(".tca").css("display", "none");
				}

			}, {
				type: 3
			})
		})
		$(".jjbtn").on("click", function() {
			_ajax('member/do_invite', function(ret, err) {
				if (ret) {
					_msg("已同意加入！")
					$(".tca").css("display", "none");
				} else {
					_msg("网络错误")
					$(".tca").css("display", "none");
				}
			}, {
				type: 2
			})

		})

		$("#ind").on("click", function() {
			api.openWin({
				name: 'new_index',
				url: './new_index.html',
			});

		})

	}

	function guanzhus() {
		if (user_data.lahei_s) {
			return _msg('对方已将您拉黑，无法关注用户');
		}
		guanzhu(uid);
	}

	// var indexListData=[
	//       {name:'我的邀请码',img:'../i/new/my_item1.png'},
	//       {name:'网红达人培训',img:'../i/new/my_item2.png'},
	//       {name:'任务中心',img:'../i/new/my_item3.png'},
	//       {name:'设置',img:'../i/new/my_item4.png'},
	//   ]
	//   var indexListText = doT.template($("#menu_template").text());
	//   $("#menu").html(indexListText(indexListData));
</script>
